package cn.abellflower.flowerhomehandler.home.controller;

import cn.abellflower.flowerhomehandler.home.comm.BeanHelper;
import cn.abellflower.flowerhomehandler.home.enums.HomeEnum;
import cn.abellflower.flowerhomehandler.home.resp.RespView;
import cn.abellflower.flowerhomehandler.home.service.HomeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Author gbzdyf@126.com
 * @Date 2020/10/23 1:21 上午
 */
@Slf4j
@RequestMapping(value = "home", produces = "application/json")
@RestController
public class HomeController {

    @RequestMapping("index")
    public RespView home(@RequestParam(required = false, defaultValue = "MY") String name) {
        log.info("输出的标志位呢");
        HomeService homeService = (HomeService) BeanHelper.getBean(HomeEnum.HOME_ENUM_MAP.get(name).getVal(), HomeEnum.HOME_ENUM_MAP.get(name).getC());
        return homeService.dealCommonBusiness(HomeEnum.MY_HOME, "");
    }

}
